package com.ruoyi.tcsp.controller.tool;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.tcsp.service.FileService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


import javax.annotation.Resource;
import javax.annotation.security.PermitAll;

/**
 * @author Hai
 * @date 2020/6/21 - 16:47
 */
@RestController
@RequestMapping("minio")
public class FileController {
  @Resource
  private FileService fileService;
  @PermitAll
  @PostMapping("/upload")
  public AjaxResult  upload(MultipartFile file)  {
    String fileUrl = fileService.upload(file);
    AjaxResult ajax = AjaxResult.success();
    ajax.put("fileUrl",fileUrl);
    return ajax;
  }
}
